Repository navigation
feat: 템플릿 삭제(휴지통 이동) API (#82) - #84
Merged
Merged
Conversation
chjpooh2002
previously approved these changes
Nov 12, 2026
chjpooh2002
left a comment
Contributor
There was a problem hiding this comment.
삭제 시 회원 행부터 잠그는 순서, 이미 휴지통에 있는 템플릿을 엔티티에서 한 번 더 막는 처리, 동시성 테스트로 덮어쓰기 문제를 직접 확인한 부분까지 깔끔하게 정리돼 있네요.
리마인드 하나만 남겨요!
#80 병합 후 기준 브랜치를 develop으로 바꿀 때, TemplateDeleteConcurrencyTest의 emptyTrash()(276~280줄)를 실제 trashCommandService.empty(userId) 호출로 바꿔 주세요. 지금은 흉내 낸 버전과 동작이 같지만, 나중에 비우기 로직이 바뀌면 이 테스트가 그 변경을 따라가지 못합니다. 이것까지 반영한 뒤 병합 부탁드려요!!
oTAETAEo
force-pushed
the
feat/82-template-delete
branch
from
November 12, 2026 15:34
540ad74 to
e3154a3
Compare
Contributor
Author
|
@chjpooh2002 말씀 주신 부분 반영 했습니다 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
관련 이슈
develop위로 rebase하고 기준 브랜치를develop으로 바꿨습니다.작업 내용
명세 12번
DELETE /api/v1/templates/{templateId}. 템플릿을 휴지통으로 옮깁니다 (소프트 삭제).TEMPLATE200_4템플릿을 휴지통으로 옮겼습니다.result:templateId,title,deletedAt,purgeAt(+09:00, 명세 순서)TEMPLATE404_1(9·11·14번과 달리404_2가 아님)deleted_at·updated_at은Clock현재 시각,edited_at·last_used_at은 그대로purgeAt은TrashRetention.purgeAt(deletedAt)(+30일)active_shortcut_keyNULL), 활성 개수 1 감소. 한도 검사 없음TemplateCommandService.delete: 메서드에@Transactional. 변경 감지로 쓰고@DynamicUpdate라 UPDATE에는deleted_at·updated_at만 들어갑니다findByIdAndUserId+ 휴지통이면 거름 →404_1. 새 레포지토리 메서드를 만들지 않았고,getActiveTemplate(휴지통이면404_2)은 쓰지 않습니다Template.moveToTrash: 이미 휴지통이면IllegalStateException(#15에서 미룬 휴지통 상태 검사). 덮어쓰면 30일 기한이 다시 시작되기 때문입니다. 서비스가 먼저404_1로 막으므로 정상 경로에서는 나오지 않습니다 (코드 실수, 500)커밋
42ecdd7엔티티 휴지통 상태 검사98c42e5삭제 API (컨트롤러·서비스·dto, 서비스·통합 테스트)6d69494동시성 테스트trashCommandService.empty로 교체테스트
./gradlew clean build)TemplateDeleteControllerTest(통합): 성공 응답·no-store·+09:00·필드 순서,purgeAt=deletedAt+ 30일,deleted_at·updated_at갱신과edited_at·last_used_at·created_at·이름·단축어·본문 유지, 휴지통 목록(15번)에 나오고 목록(8번)에서 빠짐·활성 개수 감소, 같은 단축어(대소문자만 다른 것 포함)로 새로 생성, 50개에서403_1→ 삭제 → 생성 성공, 삭제 뒤 9·11·14번404_2, 404 네 경우(내 휴지통은deleted_at·updated_at그대로), 숫자가 아닌 IDCOMMON400_1, 토큰 없음COMMON401_1TemplateDeleteConcurrencyTest(실제 커밋): 같은 템플릿 동시 삭제, 앞 삭제가 커밋 전일 때 뒤 삭제, 삭제↔비우기·삭제↔복구 양쪽 순서, 셋이 같은 순간에 오는 경우. 5번 반복해 모두 통과TemplateCommandServiceTest(모키토),TemplateTest(이미 휴지통이면 예외,deleted_at그대로)확인 체크리스트
./gradlew build통과global공통 코드 변경 없음리뷰어에게
lockUser→ 조회). 먼저 잠금 없이 구현해 동시성 테스트를 돌린 결과입니다.["SUCCESS", "SUCCESS"]였습니다. 뒤 요청이 커밋 전 스냅샷에서 활성 템플릿을 보고 행 잠금만 기다렸다가deleted_at을 덮어써, 30일 기한이 다시 시작됐습니다.FOR UPDATE로 잠가도 위 문제는 막히지만, 복구·영구 삭제·비우기(feat: 휴지통 템플릿 복구 API (#67) #69·feat: 휴지통 템플릿 영구 삭제 · 비우기 API #78)와 같은 순서(회원 행 → 템플릿 행)로 맞췄습니다. 같은 회원의 생성·복구와 줄을 서는 비용은 작습니다.trashCommandService.empty를 부릅니다 (리뷰 반영). 처음에는 기준(feat: 템플릿 사용 기록 API (#79) #80)에 18번이 없어 JDBC로 흉내 냈습니다.TemplateController·TemplateSuccessCode를 이어서 건드립니다 (200_5는 200_4와 200_6 사이).🤖 Generated with Claude Code